package qunartest02;

import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.CountDownLatch;

public class qunaerTest {

    public static void main(String[] args) {
        List<String> list = new CopyOnWriteArrayList<String>();
        CountDownLatch latch = new CountDownLatch(1000);
        for (int i = 0; i < 1000; i++) {
            new Thread(new Runnable() {
                @Override
                public void run() {
                    list.add("abc");
                    latch.countDown();
                }
            }).start();
        }

        try {
            latch.await();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        if(list.contains(null)) {
            System.out.println("list 包含 null 值");
            int index = list.indexOf(null);
            System.out.println(index);
            System.out.println(list);
        }
    }

}
